<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1·Number(数据);
        let num = Number('10'); // 10
        console.log(num);
        console.log(Number('10.5px')); // NaN
        // 2·parselnt(数据);
        console.log(parseInt('10')); // 10
        console.log(parseInt('10.5')); // 10
        console.log(parseInt('10px')); // 10
        // 3·parseFloat(数据);
        console.log(parseFloat('10')); // 10
        console.log(parseFloat('10.5')); // 10.5
        console.log(parseFloat('10.5px')); // 10.5
        // 特殊情况
        console.log(Number(ture));          //1
        console.log(Number(false));         //0
        console.log(Number(null));          //0
        console.log(Number(undefined));     //NaN

        
    </script>
</body>
</html>